/**
 * Copyright (C), 2015-2024, XXX有限公司
 * FileName: BubblingSort
 * Author:   Administrator
 * Date:     2024/3/23 16:10
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */

/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author Administrator
 * @create 2024/3/23
 * @since 1.0.0
 */
public class BubblingSort {

    public static void main(String[] args) {
        int[] arrays = {3, 8, 12, 6, 5, 4, 9, 2, 1, 7};

        for (int i = 1; i < arrays.length; i++) {
            for (int j = 0; j < arrays.length - i; j++) {
                if (arrays[j] > arrays[j + 1]) {
                    int temp = arrays[j];
                    arrays[j] = arrays[j + 1];
                    arrays[j + 1] = temp;
                }
            }
        }


        for (int i = 0; i < arrays.length; i++) {
            System.out.print(arrays[i] + " ");
        }
    }
}